<template>
  <el-card>
    <div slot="header">旋转木马</div>
    <div style="perspective: 1000px">
      <div class="cicle-rotate-box">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
      </div>
    </div>
  </el-card>
</template>

<script>
export default {}
</script>

<style lang="less" scoped>
@keyframes cicle-rotate {
  from {
    transform: rotateY(0);
  }

  to {
    transform: rotateY(360deg);
  }
}

.cicle-rotate-box {
  width: 300px;
  height: 300px;
  margin: 0 auto;
  transform-style: preserve-3d;
  /* 动画 */
  animation: cicle-rotate 10s linear infinite;

  &:hover {
    /* 停止动画 */
    animation-play-state: paused;
  }

  div {
    position: absolute;
    top: 30%;
    left: 0;
    width: 100px;
    height: 100px;
    background: url(../../../../../assets/logo.png) no-repeat;
    background-size: 100% 100%;

    &:nth-child(1) {
      transform: rotateY(0) translateZ(100px);
    }

    &:nth-child(2) {
      /* 先旋转，再移动 */
      transform: rotateY(60deg) translateZ(100px);
    }

    &:nth-child(3) {
      /* 先旋转，再移动 */
      transform: rotateY(120deg) translateZ(100px);
    }

    &:nth-child(4) {
      /* 先旋转，再移动 */
      transform: rotateY(180deg) translateZ(100px);
    }

    &:nth-child(5) {
      /* 先旋转，再移动 */
      transform: rotateY(240deg) translateZ(100px);
    }

    &:nth-child(6) {
      /* 先旋转，再移动 */
      transform: rotateY(300deg) translateZ(100px);
    }
  }
}
</style>
